package com.googlecode.moneyManager.model;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

/**
 * Author: Sergiy Doroshenko
 * Date: May 16, 2010
 * Time: 8:49:08 PM
 */
@Entity
public class CurrencyExchangeEvent extends BaseEntity{
    private Date date;
    private Amount amountFrom;
    private Amount amountTo;
    private BigDecimal rate;
    private Bank bank;

    public CurrencyExchangeEvent(Date date, Amount amountFrom, Amount amountTo, BigDecimal rate) {
        this.date = date;
        this.amountFrom = amountFrom;
        this.amountTo = amountTo;
        this.rate = rate;
    }

     @OneToOne(cascade = CascadeType.ALL)
    public Amount getAmountFrom() {
        return amountFrom;
    }
    

    public void setAmountFrom(Amount amountFrom) {
        this.amountFrom = amountFrom;
    }

    @OneToOne(cascade = CascadeType.ALL)
    public Amount getAmountTo() {
        return amountTo;
    }


    public void setAmountTo(Amount amountTo) {
        this.amountTo = amountTo;
    }

    @Column(nullable = false)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    @ManyToOne
    public Bank getBank() {
        return bank;
    }

    public void setBank(Bank bank) {
        this.bank = bank;
    }
}
